package main

import (
	"fmt"
)

// 定义一个接口
type Usber interface {
	getName() string
}

type phone struct {
	Name string
}

func (p *phone) getName() string {
	return p.Name
}

type computer struct {
	Brand string
}

func (c *computer) getName() string {
	return c.Brand
}

func tansData(usber Usber) string {
	name := usber.getName()
	return fmt.Sprintf("%s--%s", name, "处理后")
}

func main() {
	p := &phone{"iPhone"}
	c := &computer{"Mac"}
	var u, u2 Usber
	u = p
	fmt.Printf("%T %v\n", u, u)
	fmt.Println(u.getName())
	u2 = c
	fmt.Printf("%T %v\n", u2, u2)
	fmt.Println(u2.getName())
	fmt.Println(tansData(u))
	fmt.Println(tansData(u2))
}
